package projet.volleystat.automate;

import projet.volleystat.Player;
import projet.volleystat.Team;

public class PassVolleyAction extends VolleyAction{
	
	public enum Action {
		Pass,
		Reception,
		Undefined
	}
	
	Action action;
	
	public PassVolleyAction(Team team, Player player, short mark) {
		super(team, player, 0, mark);
		this.action = Action.Undefined;
	}

	public PassVolleyAction(Team team, Player player, short mark, Action action) {
		super(team, player, 0, mark);
		this.action = action;
	}
	
	public void setAction(Action action){
		this.action = action;
	}

	@Override
	public String toString() {
		String res = "";
		res = res.concat(getTime()+": ");
		switch (action) {
		case Pass:
			res = res.concat("passe de "+getPlayer().getName()+"("+getTeam().getName()+")");
			break;
		case Reception:
			res = res.concat("reception de "+getPlayer().getName()+"("+getTeam().getName()+")");
			break;
		case Undefined:
			res = res.concat("undefined de "+getPlayer().getName()+"("+getTeam().getName()+")");
			break;
			}
		return res;	
	}

	@Override
	public int getId() {
		int res = 0;
		switch (action) {
		case Pass:
			res = 36;
			break;
		case Reception:
			res = 35;
			break;
		case Undefined:
			res = 37;
			break;
			}
		return res;
	}

}
